package bancoDeDados;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 *
 * @author WELISSON
 */
public class Conexao {
    private static final String URL = "jdbc:postgresql://localhost:5432/hotel";
    private static final String DRIVER_CLASS = "org.postgresql.Driver";
    private static final String USUARIO = "postgres";  
    private static final String SENHA = "root";
    
    public Conexao() {
    }
    
    public static Connection getConnection() {
        System.out.println("Conectando ao Banco de Dados");
        try {
            Class.forName(DRIVER_CLASS);
            return DriverManager.getConnection(URL, USUARIO, SENHA);
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
        return null;
    }
}
